<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}Alist-Sync 自动化同步系统{% endblock %}</title>
    <link rel="stylesheet" href="https://s4.zstatic.net/ajax/libs/bootstrap/5.2.3/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://s4.zstatic.net/ajax/libs/bootstrap-icons/1.11.3/font/bootstrap-icons.min.css">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
    {% block extra_css %}{% endblock %}
    {% block styles %}{% endblock %}
</head>
<body class="bg-light text-dark">
    <div class="container-fluid">
        <div class="row">
            <!-- 侧边栏 -->
            <div class="col-md-2 sidebar p-0">
                <div class="d-flex flex-column p-3 h-100">
                    <div class="text-center mb-4">
                        <h3 class="logo">
                            <i class="bi bi-arrow-repeat"></i> Alist-Sync
                        </h3>
                    </div>
                    <hr>
                    <ul class="nav nav-pills flex-column mb-auto">
                        <li class="nav-item">
                            <a href="{{ url_for('main.index') }}" class="nav-link {% if request.path == url_for('main.index') %}active{% endif %}">
                                <i class="bi bi-speedometer2 me-2"></i>
                                主面板
                            </a>
                        </li>
                        <li>
                            <a href="{{ url_for('main.connections') }}" class="nav-link {% if request.path == url_for('main.connections') %}active{% endif %}">
                                <i class="bi bi-hdd-network me-2"></i>
                                连接管理
                            </a>
                        </li>
                        <li>
                            <a href="{{ url_for('main.tasks') }}" class="nav-link {% if request.path == url_for('main.tasks') %}active{% endif %}">
                                <i class="bi bi-list-task me-2"></i>
                                任务管理
                            </a>
                        </li>
                        <li>
                            <a href="{{ url_for('main.task_instances') }}" class="nav-link {% if request.path == url_for('main.task_instances') %}active{% endif %}">
                                <i class="bi bi-clipboard-check me-2"></i>
                                任务实例
                            </a>
                        </li>
                        <li>
                            <a href="{{ url_for('main.settings') }}" class="nav-link {% if request.path == url_for('main.settings') %}active{% endif %}">
                                <i class="bi bi-gear me-2"></i>
                                系统设置
                            </a>
                        </li>
                        <li>
                            <a href="{{ url_for('main.import_export_page') }}" class="nav-link {% if request.path == url_for('main.import_export_page') %}active{% endif %}">
                                <i class="bi bi-box-arrow-in-down me-2"></i>
                                导入导出
                            </a>
                        </li>
                        <li>
                            <a href="{{ url_for('main.logs') }}" class="nav-link {% if request.path == url_for('main.logs') %}active{% endif %}">
                                <i class="bi bi-journal-text me-2"></i>
                                日志查看
                            </a>
                        </li>
                    </ul>
                    <hr>
                    <!-- 用户信息和登出 -->
                    {% if session.logged_in %}
                    <div class="dropdown">
                        <a href="#" class="d-flex align-items-center text-decoration-none dropdown-toggle" id="dropdownUser" data-bs-toggle="dropdown" aria-expanded="false">
                            <div class="rounded-circle me-2 d-flex justify-content-center align-items-center" style="width: 32px; height: 32px;">
                                <i class="bi bi-person-fill"></i>
                            </div>
                            <strong>{{ session.username }}</strong>
                        </a>
                        <ul class="dropdown-menu dropdown-menu text-small shadow" aria-labelledby="dropdownUser">
                            <li>
                                <a class="dropdown-item" href="{{ url_for('auth.profile') }}">
                                    <i class="bi bi-person-circle me-2"></i>用户资料
                                </a>
                            </li>
                            <li><hr class="dropdown-divider"></li>
                            <li>
                                <a class="dropdown-item" href="{{ url_for('auth.logout') }}">
                                    <i class="bi bi-box-arrow-right me-2"></i>退出登录
                                </a>
                            </li>
                        </ul>
                    </div>
                    {% endif %}
                    <div class="text-center small mt-2">
                        <p>
                            <span>Alist-Sync v{{ current_version }}</span>
                            {% if has_update %}
                            <span class="badge bg-warning text-dark ms-1">新版本 v{{ latest_version }} 可用</span>
                            {% endif %}
                        </p>
                        <div class="d-flex justify-content-center gap-2">
                            <a href="{{ github_url }}" target="_blank" class="text-decoration-none" title="GitHub">
                                <i class="bi bi-github"></i> GitHub
                            </a>
                            <a href="{{ gitee_url }}" target="_blank" class="text-decoration-none" title="Gitee">
                                <i class="bi bi-code-slash"></i> Gitee
                            </a>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 主内容区 -->
            <div class="col-md-10 main-content ms-auto">
                <div class="p-4">
                    <div class="d-flex justify-content-between align-items-center mb-4">
                        <h2 class="page-title">{% block page_title %}{% endblock %}</h2>
                        {% block header_buttons %}{% endblock %}
                    </div>
                    
                    {% block content %}{% endblock %}
                </div>
            </div>
        </div>
    </div>

    <script src="https://s4.zstatic.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <script src="https://s4.zstatic.net/ajax/libs/bootstrap/5.2.3/js/bootstrap.bundle.min.js"></script>
    <script src="https://s4.zstatic.net/ajax/libs/Chart.js/4.4.1/chart.umd.min.js"></script>
    <script src="{{ url_for('static', filename='js/main.js') }}"></script>
    {% block extra_js %}{% endblock %}
</body>
</html> 